package com.demo.blog.mapper;

import com.demo.blog.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-07-24
 * Time: 11:27
 */
@Mapper
public interface UserInfoMapper {
    /**
     * 根据用户名, 查询用户信息
     */
    @Select("select * from user where user_name =#{userName} and delete_flag=0")
    User queryByName(String userName);
    /**
     * 根据用户ID, 查询用户信息
     */
    @Select("select * from user where id=#{id} and delete_flag=0")
    User queryById(Integer id);

    @Insert("insert into user(user_name,password) values (#{userName},#{password})")
    Boolean insertUser(String userName, String password);
}